""""
提供基础的函数，给到所有的页面对象执行;
    元素定位
    切换页面访问url输入点击
"""

from selenium import webdriver
from time import sleep

class BasePage():
    def __init__(self, driver):
        self.driver = driver

    # get
    def open(self, url):
        self.driver.get(url)

    # locate
    def locate(self, name, value):
        return self.driver.find_element(name, value)

    # input
    def input_(self, name, value, txt):
        self.locate(name, value).send_keys(txt)

    # click
    def click(self, name, value):
        self.locate(name, value).click()


    def wait_(self,time_):
        sleep(time_)

    # sleep
    def sleep(self, time_):
        sleep(time_)

    # quit
    def quit(self):
        self.driver.quit()

